<!-- student_study_freecourse_interactiveNew.html -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>互动资源章节页</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css" />
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
	</head>
	<body></body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<!--	<script type="text/javascript" src="../../script/MD5.js"></script>-->
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript">
		var message;
		apiready = function() {
			setupSubFrame();
			setupNotifi();
		};
		//准备数据//
		function prepareData() {
			api.setScreenOrientation({
				orientation : 'auto'
			});
		}

		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				uname : $api.getStorage('cfnetppusername'),
				cid : api.pageParam.cid,
				pid : api.pageParam.planid,
				vid : api.pageParam.id
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}

		function setupSubFrame() {
			if (api.pageParam.openType == "skillCourse") {//技能课程
				message = "学习技能课程" + "《" + api.pageParam.cdetailtitle + "》" + "</br>" + api.pageParam.quarter_name + "认证";
				SendBehaviorTrajectoriesNotifi_Authentication('0', '技能课程列表详情页', '130', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title, message);
			} else {
				sendBuriedNotifi('0', '互动资源章节', '153');
			}
			var pageUrl = "";
			//自由课程测试服地址
			var url = "http://cfnet.org.cn/index.php?app=";
			//Mocc课程正式服地址
			var mocc_url = "http://ykt.cfnet.org.cn/index.php/";
			if (api.pageParam.hdresourceType == 0) {//老板资源
				if (api.pageParam.type == 1) {//教学
					// 旋转屏幕至横屏
					api.setScreenOrientation({
						orientation : 'landscape_left'
					});
					var pageUrl = url + "mobile&mod=HdtaskInterface&act=freecoursehd&pid=" + api.pageParam.pid + "&cid=" + api.pageParam.cid + "&chapterid=" + api.pageParam.id;
				} else if (api.pageParam.type == 2) {//普通认证课程和认证技能课程中的自由课程的互动资源课程新版
					prepareData();
					pageUrl = url + "home&mod=HdRenzeng&act=renZengHddetail&id=" + api.pageParam.id + "&uid=" + $api.getStorage('cfnetppuid');
				}
			} else {//新版资源
				if (api.pageParam.hasOwnProperty("ismocc") && api.pageParam.ismocc == 1) {//如果是mocc的互动资源
					prepareData();
					pageUrl = mocc_url + "mooc/study/ajaxMoocDetail/?pid=" + api.pageParam.pid + "&cid=" + api.pageParam.cid + "&vid=" + api.pageParam.id + "&user_id=" + $api.getStorage('cfnetppuid') + "&jid=" + $api.getStorage('cfnetppjxid');
				} else {
					prepareData();
					pageUrl = url + "mobile&mod=HdtaskInterface&act=freecoursehd&chapterid=" + api.pageParam.id + "&cid=" + api.pageParam.cid + "&pid=" + api.pageParam.pid;
				}
			}
			
			var rect = {
				x : 0,
				y : '22',
				w : 'auto',
				h : 'auto'
			};
			api.openFrame({
				name : 'frame',
				url : pageUrl,
				bounces : false,
				rect : rect,
				progress : {//设置进度条类型和样式
					type : 'page',
					color : '#18b4ed'
				}
			});
			api.openFrame({//打开返回按钮
				name : 'student_study_freecourse_interactive_back',
				url : 'student_study_freecourse_interactive_back.html',
				rect : {
					x : 0,
					y : '0',
					w : '44',
					h : '66',
				},
				pageParam : {
					sourceurl : api.pageParam.sourceurl,
					sourcetitle : api.pageParam.sourcetitle,
					accesspageurl : window.location.pathname,
					accesspagetitle : document.title,
					openType : api.pageParam.openType,
					quarter_name : api.pageParam.quarter_name,
					cdetailtitle : api.pageParam.cdetailtitle,
					cid : api.pageParam.cid,
					pid : api.pageParam.pid,
					vid : api.pageParam.id,
					entryParam : api.pageParam
				}
			});
		}

		function setupNotifi() {
			//监听返回按钮
			api.addEventListener({
				name : 'keyback'
			}, function(ret, err) {
				onBackClick();
			});
			//监听页面返回按钮
			api.addEventListener({
				name : 'hdBackNotifi'
			}, function(ret, err) {
				onBackClick();
			});
		}

		function onBackClick() {
			//			if (api.pageParam.openType == "skillCourse") {//技能课程
			//				message = "学习技能课程" + "《" + api.pageParam.cdetailtitle + "》" + "</br>" + api.pageParam.quarter_name + "认证";
			//				SendBehaviorTrajectoriesNotifi_Authentication('0', '技能课程列表详情页', '130', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title, message);
			//			} else {
			//				sendBuriedNotifi('1', '互动资源章节', '153');
			//			}
			//退出时发送结束学习通知
            api.sendEvent({
                name: 'freeCourseRecordNotifi',
                extra: {
            		uid : $api.getStorage('cfnetppuid'),
					jid : $api.getStorage('cfnetppjxid'),
					cid : api.pageParam.cid,
					vid : api.pageParam.id,
					pid : api.pageParam.pid
                }
            });
            //退出时传回mooc入参
            api.sendEvent({
                name: 'moocCourseRecordNotifi',
                extra: api.pageParam
            });
			api.setScreenOrientation({
				orientation : 'portrait_up'
			});
			api.closeWin();
		}
	</script>
</html>